import {BDialog, BDialogComponent} from './bDialog';
import {BSearch} from './bSearch';
import {BList} from './bList';
import {PageButton} from './page-button.model';
import {Injectable} from '@angular/core';
import {StorageService} from '../services/storage.service';

@Injectable()
export class BPage {
  constructor(
    private ss: StorageService
  ){}
  title:string;  // 标题
  layout: string; // 布局方式
  data:any;  // 数据
  config:any; // 配置
  buttons: any;  // 按钮
  dictionaries: any; // 字典
  // 权限
  list?: BList = new BList();
  dialogs?: BDialogComponent[] = [];
  search?: BSearch;
  map?:any;
  echarts?:any;

  /**
   * 页面中的按钮信息
   * @returns {PageButton}
   */
  // get buttons(){
  //   let listBtnData = [];
  //   if (this.ss.menuCurr) {
  //     const currModule = this.ss.menuCurr;
  //     if (currModule && currModule['functions'] && currModule['functions'].length > 0) {
  //       const buttonData = currModule['functions'];
  //       // listBtnData=buttonData.filter(m=>m.layout.indexOf('list')>=0);
  //       listBtnData = buttonData;
  //     }
  //   }
  //   const buttons = new PageButton();
  //   buttons.listTopButtons = listBtnData.filter(m => m.layout === 'top');
  //   buttons.listRowButtons = listBtnData.filter(m => m.layout === 'row');
  //   buttons.hasRowButtons = buttons.listRowButtons.length > 0 ? true : false;
  //   return buttons;
  // }
}
